﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/// <summary>
/// 通用返回对象
/// </summary>
/// <typeparam name="K"></typeparam>
public class CallBak<K>
{
    /// <summary>
    /// 是否成功
    /// </summary>
    public bool IsSuccess { get { return _IsSuccess; } set { _IsSuccess = value; } }
    private bool _IsSuccess = true;
    /// <summary>
    /// 错误信息
    /// </summary>
    public string ErrMsg { get { return _ErrMsg; } set { _ErrMsg = value; } }
    private string _ErrMsg = "";
    /// <summary>
    /// 返回值
    /// </summary>
    public K ReturnVal { get { return _ReturnVal; } set { _ReturnVal = value; } }
    private K _ReturnVal;
    /// <summary>
    /// 构造错误信息
    /// </summary>
    /// <param name="errMsg_">错误提示文字</param>
    public CallBak<K> Err(string errMsg_)
    {
        _IsSuccess = false;
        _ErrMsg = errMsg_;
        return this;
    }
    /// <summary>
    /// 构造返回值
    /// </summary>
    /// <param name="v_">返回值</param>
    /// <returns></returns>
    public CallBak<K> Set(K v_)
    {
        _ReturnVal = v_;
        return this;
    }
}

